<template>
    <el-form-item :label="setAttr('label', '')" :prop="setAttr('prop', '')">
      <slot></slot>
    </el-form-item>
</template>

<script>
import { ref, toRef } from 'vue'
export default {
    name: 'Form',
    props: {
        item: {
            type: Object,
            default: function () {
                return {}
            }
        },
        value: null
    },
    setup(props, context) {
        // 双向绑定数据
        const item = toRef(props, 'item')
        let modelValue = ref([])
        function setAttr(name, value = '') {
            return Object.prototype.hasOwnProperty.call(item.value.attribute, name) ? item.value.attribute[name].value : value
        }
        return {
            setAttr
        }
    },
    watch: {},
    methods: {},
    mounted() {}
}
</script>

<style></style>
